local CommonOHOH = _G.CommonOHOH;
local M = CommonOHOH.class.new(script, script.Parent.BuffBase);
function M.new(self,...)
	return M(self,...);
end;
function M.ctor(self,player,time,cfg)
    self.cfg=cfg
    self.player = player
    M.super.ctor(self,player,time);
end;

function M.Use(self)
  self:ManipulateData(1)
end

--mul为1则加，mul为-1则减
function M.ManipulateData(self,mul)
    if not self.RngDataCtrl then
        self.RngDataCtrl = self.player:GetComponent(_G.CommonOHOH.load.Common_RngDataLayer())
    end
    for index, value in pairs(self.cfg.value) do
        if self.cfg.property[index] == 1 then
            self.RngDataCtrl:AddLucky(value*mul)
        elseif self.cfg.property[index] == 2 then
            self.RngDataCtrl:AddShinyLucky(value*mul)
        elseif self.cfg.property[index] == 3 then
            self.RngDataCtrl:AddRainbowLucky(value*mul)
        elseif self.cfg.property[index] == 4 then
            self.RngDataCtrl:AddVoidLucky(value*mul)
        elseif self.cfg.property[index] == 5 then
            self.RngDataCtrl:AddRollSpeed(value*mul)
        end
   end
end

function M.dtor(self)
    self:ManipulateData(-1)
    if self.Conn then
        self.Conn:Disconnect()
        self.Conn=nil
    end
	M.super.dtor(self);
end;




return M;
